package org.zero.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @author Zero
 */
@Controller
@RequestMapping("/path_variable")
public class PathVariableController {

    /**
     * PathVariable：
     * 作用：指明URL中的占位符
     * 属性：
     * name：同value一样，指定占位符
     * required：默认true。指定是否必须有设置的占位符
     *
     * @param username
     * @return
     */
    @RequestMapping("/m1/{name}")
    public String method1(@PathVariable("name") String username) {
        System.out.println("方法1：name：" + username);
        return "success";
    }
}
